package com.jd.finance.oss.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 *
 * </p>
 *
 * @author LiQingBo
 * @since 2022-05-29
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "OssObject对象", description = "")
public class OssObject implements Serializable {

    private static final long serialVersionUID = 1L;
    /**  对象存储状态-存活  **/
    public final static int STATUS_ALIVE = 1;
    /**  对象存储状态-已删除  **/
    public final static int STATUS_DELETED = 0;

    @ApiModelProperty(value = "内部自生成主键")
    @TableId(value = "OBJECT_ID", type = IdType.AUTO)
    private Long objectId;

    @ApiModelProperty(value = "对象上传唯一KEY")
    @TableField("OBJECT_KEY")
    private String objectKey;

    @ApiModelProperty(value = "对象名称")
    @TableField("OBJECT_NAME")
    private String objectName;

    @ApiModelProperty(value = "对象类型")
    @TableField("OBJECT_TYPE")
    private String objectType;

    @ApiModelProperty(value = "对象大小")
    @TableField("OBJECT_SIZE")
    private String objectSize;

    @ApiModelProperty(value = "上传用户ID")
    @TableField("UPLOAD_PERSONNEL_ID")
    private Long uploadPersonnelId;

    @ApiModelProperty(value = "上传用户姓名")
    @TableField("UPLOAD_PERSONNEL_NAME")
    private String uploadPersonnelName;

    @ApiModelProperty(value = "上传时间")
    @TableField("UPLOAD_TIME")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime uploadTime;

    @ApiModelProperty(value = "1存活, 2已删除")
    @TableField("STATUS")
    private Integer status;

    @ApiModelProperty(value = "删除用户ID")
    @TableField("DELETE_PERSONNEL_ID")
    private Long deletePersonnelId;

    @ApiModelProperty(value = "删除用户姓名")
    @TableField("DELETE_PERSONNEL_NAME")
    private String deletePersonnelName;

    @ApiModelProperty(value = "删除时间")
    @TableField("DELETE_TIME")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime deleteTime;

    //扩展字段
    @ApiModelProperty(value = "OSS访问路径")
    @TableField(exist = false)
    private String objectUrl;

    @ApiModelProperty(value = "签名的URL对象")
    @TableField(exist = false)
    private String url;

    @ApiModelProperty(value = "原始文件对象签名的URL对象")
    @TableField(exist = false)
    private String originUrl;

}
